# coding gbk
from kivy.app import App
from kivy.graphics import Color,Rectangle
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.image import AsyncImage
class RootWidget(BoxLayout):
    pass
class CustomLayout(FloatLayout):
    def __init__(self,**kwargs):
        super(CustomLayout,self).__init__(**kwargs)
        with self.canvas.before:
            Color(0,0,1,1)
            self.rect=Rectangle(size=self.size,pos=self.pos)
        self.bind(size=self._update_rect,pos=self._update_rect)
    def _update_rect(self,instance,value):
        self.rect.pos=instance.pos
        self.rect.size=instance.size
class MainApp(App):
    def build(self):
        root=RootWidget()
        c=CustomLayout()
        root.add_widget(c)
        c.add_widget(
            AsyncImage(
                source="http://b19.photo.store.qq.com/psu?/35191185-00e0-4b67-a68d-722d05872c89/PTX9cuWZ6IPILHZeFKEBgt655vpge6alTsZcFkkBvgM!/b/YauHZQuKagAAYk2RaAv4SwAA&bo=ngL2AQAAAAABAEw!&rf=viewer_4",
                size_hint=(1,.5),
                pos_hint={"center_x":.5,"center_y":.5}))
        root.add_widget(AsyncImage(source="http://b271.photo.store.qq.com/psb?/V14Ust2T3MTlZN/5219bFKfBf.83eW*56e7dMZfW3lwidbW5tHd8DxT3s0!/b/dD74i6HyHAAA&bo=IAMUAgAAAAABFwU!&rf=viewer_4"))
        c=CustomLayout()
        c.add_widget(
            AsyncImage(
                source="http://m.qpic.cn/psu?/35191185-00e0-4b67-a68d-722d05872c89/RZSQLlT6I3m4evigRkYr5c38aBDKpCWDN6zFwXlOh.0!/b/YYkCZAsCmQAAYnpInQmYhQAA&a=19&b=16&bo=ngL2AQAAAAABEFw!&rf=viewer_4",
                size_hint=(1,.5),
                pos_hint={"center_x":.5,"center_y":.5}))
        root.add_widget(c)
        return root
if __name__=="__main__":
    MainApp().run()